package com.cn.xiaonuo.tcrfinance.tcrusers.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cn.xiaonuo.tcrfinance.tcrusers.entity.PvWalletShop;
import com.cn.xiaonuo.tcrfinance.tcrusers.entity.PvWalletShopLog;
import com.cn.xiaonuo.tcrfinance.tcrusers.vo.IdentityRevocationVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@Repository
public interface PvWalletShopMapper extends BaseMapper<PvWalletShop> {
    BigDecimal selectTotal(@Param("userId") Integer userId);

    List<PvWalletShop> list(@Param("userId") Integer userId);

    /**
     *
     * @author likui
     * @date 2023/06/17 13:23
     * @param delistingUserId 用户id
     * @param buyMoney 多少钱
     * @param productionStoreId 店铺id
     * @param types 1:加钱 2:扣钱
     * @return java.lang.Integer
     */
    Integer updateWallet(@Param("delistingUserId") Integer delistingUserId,@Param("buyMoney") BigDecimal buyMoney,@Param("productionStoreId") Integer productionStoreId,@Param("types") int types);

    /**
     *
     * @author likui
     * @date 2023/06/17 13:23
     * @return void
     */
    void addPvWalletShopLog(PvWalletShopLog pvWalletShopLog);

    /**
     *
     * @author likui
     * @date 2023/06/18 14:08
     * @param userId
     * @param productId
     * @return java.util.Map<java.lang.String,java.lang.Object>
     */
    Map<String, Object> queryUserWalletShop(@Param("userId") Integer userId,@Param("productId") Integer productId);

    /**
     * 根据userId查询商家钱包
     * @param userId
     * @return
     */
    List<PvWalletShop> selectPvWalletShopByUserId(Integer userId);

    /**
     * 商家钱包价钱或者减钱
     * @param shopId
     * @param money
     * @param types
     * @return
     */
    Integer updateWalletShopInfoByShopIdAndUserId(@Param("shopId") Integer shopId, @Param("userId") Integer userId, @Param("money") BigDecimal money, @Param("types")Integer types);

    /**
     * 校验金额
     * @param userIdList
     * @return
     */

    List<IdentityRevocationVo> selectTotalBalanceList(@Param("userIdList") List<Integer> userIdList);
}
